#pragma once
#include "MovableObject.h"
#include "Renderable.h"
#include "MaterialParameter.h"
class Mesh;

class Shape : public MovableObject, public Renderable
{
public:
	Shape(const std::string& name, Scene* owner);
	virtual ~Shape();
	
	const Mesh* getMesh() const { return mMesh; }

	virtual VertexFactory* getVertexFactory();
	virtual MaterialInstance* getMaterial();
	virtual const IndexData* getIndexData() const;

	inline const Vector4& getEmissive() const { return mEmissive; }
	inline void setEmissive(const Vector4& v) { mEmissive = v; }
	
	inline const Vector4& getDiffuse() const { return mDiffuse; }
	inline void setDiffuse(const Vector4& v) { mDiffuse = v; }
	
	inline const Vector4& getSpecular() const { return mSpecular; }
	inline void setSpecular(const Vector4& v) { mSpecular = v; }
	
	virtual const char* getMovableType() const { return "Shape"; };
	virtual const char* getShapeMeshName() const = 0;

	virtual bool Init(const NameValeParamMap* params);
	virtual void AddToView(RenderView* view);
	virtual void UpdateTransform();

	void ApplyColorChange();

protected:
	virtual void AddToScene();
	virtual void RemoveFromScene();

private:
	Vector4 mEmissive;
	Vector4 mDiffuse;
	Vector4 mSpecular;
	MaterialParameterRef mEmissiveParamRef;
	MaterialParameterRef mDiffuseParamRef;
	MaterialParameterRef mSpecularParamRef;

	MaterialInstance* mMaterialInstance;
	const Mesh* mMesh;
};
